<!DOCTYPE html>
<html class="" lang="zh-CN">

<head>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
    <title>中国人类遗传资源样本信息管理平台</title>
    <meta charset="utf-8">
    <meta content="always" name="referrer">
    <meta content="Chrome=1,IE=edge" http-equiv="X-UA-Compatible">
    <link rel="stylesheet" href="skin/WdatePicker.css">
</head>

<body>
<input class="Wdate newsTimes" type="text" name="noteDate" value="" onclick="WdatePicker({el:this,dateFmt:'yyyy-MM-dd HH:mm:ss'})" autocomplete="off">
<script src="jquery.min.js" charset="utf-8"></script>
<script src="WdatePicker.js"></script>
<script>
  init();
  function init(){
    $('.newsTimes').val(initDate())
  };
  //获取当前时间
  function initDate(){
    //设置结束日期为当前日期
    var date = new Date();
    var seperator1 = "-";
    var seperator2 = ":";
    var month = date.getMonth() + 1;
    var strDate = date.getDate();
    if(month >= 1 && month <= 9) {
      month = "0" + month;
    }
    if(strDate >= 0 && strDate <= 9) {
      strDate = "0" + strDate;
    }
    var end = date.getFullYear() + seperator1 + month + seperator1 + strDate
    +" " + date.getHours() + seperator2 + date.getMinutes() + seperator2 + date.getSeconds();
    // $("#EndTime").val(end);

    // //设置开始日期为当前日期的前一个月
    // date.setMonth(date.getMonth()-1);
    // var begin = date.getFullYear() + "-" + (date.getMonth()+1) + "-" + date.getDate()+
    //   " " + date.getHours() + seperator2 + date.getMinutes() +seperator2 + date.getSeconds();
    // return begin + end
    // $("#BeginTime").val(begin);
    return end
  }
</script>
</body>

</html>